package com.huawei.appmarket.service.appdetail.view.card;

import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import com.huawei.appgallery.jsonkit.api.JsonBean;
import com.huawei.appmarket.service.appdetail.bean.detail.DetailPermissionBean;
import com.huawei.appmarket.service.appdetail.bean.detail.DetailPermissionBean.DetailPermissionItemBean;
import com.huawei.appmarket.service.appdetail.view.widget.DetailPermissionProtocol;
import com.huawei.appmarket.service.appdetail.view.widget.DetailPermissionProtocol.Request;
import com.huawei.appmarket.service.settings.view.widget.EnterLayout;
import java.util.List;
import o.cjk;
import o.cjm;
import o.cjo;
import o.ckt;
import o.drl;
import o.ewm.h;
import o.ewm.j;

public class DetailPermissionCard extends drl implements OnClickListener {
    private List<DetailPermissionItemBean> ʻ;
    protected EnterLayout ʼ;
    protected DetailPermissionBean ॱॱ;

    public View ˊ(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        this.ˊ = layoutInflater.inflate(h.ˏꓸ, null);
        this.ʼ = (EnterLayout) this.ˊ.findViewById(j.ˋᐣ);
        this.ʼ.setOnClickListener(new ckt(this));
        this.ʼ.setMaxLines(1);
        return this.ˊ;
    }

    public boolean ˊ(List<JsonBean> list) {
        if (list == null || list.size() <= 0) {
            return false;
        }
        this.ॱॱ = (DetailPermissionBean) list.get(0);
        if (this.ॱॱ == null) {
            return false;
        }
        this.ʻ = this.ॱॱ.ॱ();
        if (this.ʻ == null || this.ʻ.size() == 0) {
            this.ʼ.setVisibility(8);
            return false;
        } else if (ˎ(((DetailPermissionItemBean) this.ʻ.get(0)).ˋ())) {
            return true;
        } else {
            this.ʼ.setVisibility(8);
            return false;
        }
    }

    protected boolean ˎ(String str) {
        if (TextUtils.isEmpty(this.ॱॱ.v_()) || TextUtils.isEmpty(str)) {
            return false;
        }
        this.ʼ.setTitle(this.ॱॱ.v_());
        this.ʼ.setMemo(str);
        return true;
    }

    public void onClick(View view) {
        if (view.getId() == j.ˋᐣ) {
            cjo detailPermissionProtocol = new DetailPermissionProtocol();
            Request request = new Request();
            request.ˏ(this.ʻ);
            request.ˏ(this.ॱॱ.v_());
            detailPermissionProtocol.ˎ(request);
            cjk.ˎ().ˋ(view.getContext(), new cjm("detail.permission.activity", detailPermissionProtocol));
        }
    }

    public void ʽ() {
        if (this.ʼ != null) {
            this.ʼ.setLastLineGone();
        }
    }
}
